const Base = require('./base.js');
module.exports = class extends Base {
	constructor(ctx) {
		super(ctx);
		this.user_coupon = this.model('store/user_coupon');
	}
	async indexAction() {
		if(this.isGet) {
			return this.display();
		}

		let posts = this.post();

		let where = {};
		if(!think.isEmpty(posts.userid)){
			where.user_id = posts.userid;
		}
		if(!think.isEmpty(posts.couponid)){
			where.coupon_id = posts.couponid;
		}
		const data = await this.user_coupon.dataTable(posts, where);
		console.log(JSON.stringify(data))
		return this.json(data);
	}
	
};